<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>循环语句</title>
</head>
<body>
<script>
    var sum=0;
    for (var i = 1; i <= 100; i++) {
        sum+=i;
    }
    console.log(sum);
    //水仙花数
    var i=100;
while (true){
    if(i===1000){
        break;
    }
    var ge=i%10;
    var shi=(i-ge)/10%10;
    var bai=(i-shi*10-ge)/100;

    if(bai*bai*bai+shi*shi*shi+ge*ge*ge==i){
        console.log(i)
    }
    i++;
}
//完美数判断 1000以内
console.log("完美数判断")
for(var i=1;i<=1000;i++){
    var num=0;
    for(var j=1;j<i;j++){
        if(i%j===0){
            num+=j;
        }
    }
    if(num===i){
        console.log(i);
    }
}

//100000以内回文数
    console.log("回文数判断")
 var num=10000;
var count=0
do{
    var num1=num+"";
    var wan=num1.slice(0,1);
    var qian=num1.slice(1,2);
    var bai=num1.slice(2,3);
    var shi=num1.slice(3,4);
    var ge=num1.slice(4,5);

    if ((wan==ge)&&(qian==shi)){
        count++;
        console.log(num);
    }
    num++;
}while (num<100000);
console.log(count)

</script>
</body>
</html>